import { fetch, query } from 'api'
// 查询停车信息
const _parkInfo = (openid, carnum) => {
  return fetch(
    'Parking.ashx',
    {
      v: 'getcarinfo',
      CarNo: carnum,
      OpenID: openid
    }
  )
}
// 支付优惠信息
const _discountsInfo = (openid, carnum) => {
  return fetch(
    'Parking.ashx',
    {
      v: 'getickets',
      OpenID: openid,
      CarNo: carnum
    }
  )
}
// 支付
const _pay = (openid, carnum, paytime, tickets, vipticket) => {
  return fetch(
    'Parking.ashx',
    {
      v: 'pay',
      OpenID: openid,
      CarNo: carnum,
      PayTime: paytime,
      Tickets: tickets,
      VipTicket: vipticket
    }
  )
}
// 优惠券分类
const _ticketType = (openid, status) => {
  return fetch(
    'Parking.ashx',
    {
      v: 'getmtickettitle',
      OpenID: openid,
      status
    }
  ) 
}
// 优惠券列表管理
const _ticketList = (openid, status, pageIndex, hour) => {
  return fetch(
    'Parking.ashx',
    {
      v: 'getmticket',
      OpenID: openid,
      status,
      Page: pageIndex,
      Hour: hour
    }
  )
}
// 停车历史
const _record = (openid, day) => {
  return fetch(
    'Parking.ashx',
    {
      v: 'getorderlist',
      OpenID: openid,
      Day: day
    }
  )
}
// 领取优惠券
const _getTicket = (openid, code) => {
  return fetch(
    'Parking.ashx',
    {
      v: 'sendticket',
      OpenID: openid,
      code
    }
  )
}
// 寻车
const _findcar = carNo => fetch(
  'Parking.ashx',
  {
    v: 'getcarimg',
    CarNo: carNo
  }
)
export {
  _parkInfo,
  _discountsInfo,
  _pay,
  _ticketType,
  _ticketList,
  _record,
  _getTicket,
  _findcar
}